import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import WindiCSS from 'vite-plugin-windicss'
import path from 'path'

import electron from 'vite-plugin-electron'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), WindiCSS(),],
  base: './',
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src')
    }},
 css: {
    loaderOptions: {
      sass: {
        additionalData:   // 8版本用prependData:
        `
          @import "@/styles/variables.scss";  // scss文件地址
          @import "@/styles/mixin.scss";     // scss文件地址
        `
      }
    }
  },

 server: {
    proxy: {
    '/api': {
      target: 'http://wzmzero.top:8001',
      changeOrigin: true,
      ws: true,
    },
      '/mqtt': {
      target: 'wss://122.51.127.33:8084',
      changeOrigin: true,
      ws: true,
      rewrite: (path) => path.replace(/^\/mqtt/, ''),
    },
  }}
},)
